package StudyCode.summary.regularexpressionsmatch;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class RegularExpressionReplacement {
	public static void main(String[] argv) {
		String regex = "test";
		String replace = "t";
		System.out.println("替换前：" + regex);
		System.out.println("替换后：");
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher("");
		matcher.reset("s");
		System.out.println(matcher.replaceFirst(replace));
		System.out.println(matcher.replaceAll(replace));
	}
}
